package com.food.eat.controller;

import com.food.eat.pojo.Model;
import com.food.eat.service.ModelsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @Author:RenPu
 * @Date: 2020/7/18 16:49
 * @Version: 1.0
 * @description:
 */

//@ApiIgnore    //此注解让swagger2忽略对此类，生成接口文档
@RestController
public class HelloController {

    @Autowired
    private ModelsService modelsService;

    @GetMapping(value = "testOne")
    public Object testOneMenthond() {
        return "HELLO-WORLD";
    }


    /**
     * 新增数据方法
     *
     * @return
     */
    @GetMapping("/addMessage")
    public int addMessage() {
        return modelsService.addMessage();
    }


    /**
     * 查询方法
     *
     * @return
     */
    @GetMapping("/getMess")
    public Model queryDetialMessage() {
        return modelsService.queryDetialMessage();
    }


    /**
     * 删除方法
     *
     * @param firstDataId
     * @param levelDatalevelDataId
     * @return
     */
    @GetMapping("/updateMessage")
    public Model updateMessage(@RequestParam(required = false) String firstDataId,
                               @RequestParam(required = false) String levelDatalevelDataId) {
        return modelsService.updateMessage(firstDataId, levelDatalevelDataId);
    }


}
